#ifndef ATTRIBUTEEDITOR_H
#define ATTRIBUTEEDITOR_H

#include <QDialog>

#include "uml/datatypedictionary.h"
#include "gui/editors/highlighters/umlmethodhighlighter.h"

class ClassAttribute;
class UmlClassItem;
class ClassMethod;

namespace Ui {
    class AttributeEditor;
}

class AttributeEditor : public QDialog {
    Q_OBJECT
public:
    AttributeEditor(UmlClassItem *classItem, ClassAttribute *att = 0);
    ~AttributeEditor();

    void setClassItem(UmlClassItem *classItem);
    void setAttribute(ClassAttribute *att);
    void setDatatypes(DatatypeDictionary *datatypes);

protected:
    void changeEvent(QEvent *e);

private slots:
    ClassAttribute* save();

    void update();

private:
    Ui::AttributeEditor *ui;

    ClassAttribute *_att;
    UmlClassItem *_classItem;
    DatatypeDictionary *_datatypes;

    UmlMethodHighlighter *_attHighlighter;
    UmlMethodHighlighter *_getterHighlighter;
    UmlMethodHighlighter *_setterHighlighter;

    ClassMethod *_getter;
    ClassMethod *_setter;

    QString capitalize(QString string);
};

#endif // ATTRIBUTEEDITOR_H
